import {post2, post, get} from "../requset";
import type {loginForm,loginFormData,loginResponseData,userInfoReponseData} from "./type";
import request from "../index";

// export const loginnew = (params) => post(`/newApi/rxsj/system/account/login`, params);

enum API {
    loginUrl = '/newApi/rxsj/system/account/login',
    validationUrl = '/newApi/rxsj/system/account/get_validation_code_image',
    LOGIN_URL = '/api/admin/acl/index/login',
    USERINFO_URL = '/api/admin/acl/index/info',
    LOGOUT_URL = '/api/admin/acl/index/logout',
}

export const loginnew = (params: loginForm) => post(API.loginUrl, params);

export const getValidation = () => get(API.validationUrl);
// export const getValidationCodeImage = () => get(`/newApi/rxsj/system/account/get_validation_code_image`);
//登录接口
export const reqLogin = (data: loginFormData) =>
    request.post<any, loginResponseData>(API.LOGIN_URL, data)
//获取用户信息
export const reqUserInfo = () =>
    request.get<any, userInfoReponseData>(API.USERINFO_URL)
//退出登录
export const reqLogout = () => request.post<any, any>(API.LOGOUT_URL)
